package com.rongke.web.h5controller;

import com.rongke.model.Doctor;
import com.rongke.model.Medicine;
import com.rongke.service.DoctorService;
import com.rongke.service.MedicineService;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @UserController
 * @Controller
 * @version : Ver 1.0
 */
@Controller
public class MedicineDetailController {
    private static final Logger LOGGER = Logger.getLogger(MedicineDetailController.class);

    @Autowired
    private MedicineService     medicineService;

    /**
     * 单个新闻详情
     * 
     * @param newsId
     * @return
     */
    @RequestMapping(value = "/medicine/medicineDetail.html")
    public ModelAndView viewMedicineDetail(long medicineId) {
        try {
            ModelAndView result = new ModelAndView();

            Medicine medicine = medicineService.selectById(medicineId);
            if (null == medicine) {
                result.setViewName("common/404");
                return result;
            }

            result.addObject("medicine", medicine);
            result.setViewName("expert/expert_detail");

            return result;
        } catch (Exception e) {
            LOGGER.error("viewMedicineDetail failed", e);
            throw e;
        }
    }

}
